package com.huidian.busi.server.controller;


import com.huidian.resource.client.dto.StudentDto;
import com.huidian.resource.client.enhance.MeterFeignEnhance;
import com.huidian.resource.client.enhance.StudentFeignEnhance;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author tjs
 */
@RestController
@RequestMapping("/resource")
@Slf4j
public class ResourceCrossServiceQueryController {


    @Resource
    private MeterFeignEnhance meterFeignEnhance;

    @Resource
    private StudentFeignEnhance studentFeignEnhance;

    @GetMapping("/query")
    public Object query(@RequestParam Long meterId){
        return meterFeignEnhance.getMeterByMeterId(meterId);
    }

    @GetMapping("/queryStudentById")
    public Object queryStudentById(@RequestParam Long stdId){
        return studentFeignEnhance.selectById(stdId);
    }

    @GetMapping("/queryStudentBySchoolId")
    public Object queryStudentBySchoolId(@RequestParam Long schoolId){
        return studentFeignEnhance.selectBySchoolId(schoolId);
    }

    @GetMapping("/queryStudentByCountyId")
    public Object queryStudentByCountyId(@RequestParam Long countyId){
        return studentFeignEnhance.selectByCountyId(countyId);
    }

    @PostMapping("/queryStudentList")
    public Object queryStudentList(@RequestBody StudentDto studentDto){
        return studentFeignEnhance.selectPageList(studentDto);
    }
}
